vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
vim.opt.termguicolors = true
vim.g.neo_tree_remove_legacy_commands = 1

local keys = {
    { "<leader>ff", "<cmd>Neotree<CR>",        },
    { "<leader>fb", "<cmd>Neotree buffers<CR>" },
}

local config = {
    window = { position = "current", width = 30 },
    enable_diagnostics = false,
    default_component_configs = {
        indent = { padding = 1 },
        icon = {
            folder_closed = "+",
            folder_open = "-",
            folder_empty = "0",
            folder_empty_open = "?",
        },
        git_status = {
            symbols = {
                added = "+",
                modified = "*",
                renamed = "R",
                deleted = "X",

                unstaged = "!",
                untracked = "?",
            },
        },
    },
    source_selector = {
        sources = {
            { source = "filesystem", display_name = " Files"   },
            { source = "buffers",    display_name = " Buffers" },
            { source = "git_status", display_name = " Git"     },
        },
    },
    filesystem = {
        filtered_items = {
            hide_dotfiles = false,
            hide_gitignored = false,
            never_show = { ".git" },
        },
    },
}

return {
    url = "https://github.com/nvim-neo-tree/neo-tree.nvim",
    lazy = false,
    branch = "v3.x",
    dependencies = {
        "https://github.com/nvim-lua/plenary.nvim",
        "https://github.com/MunifTanjim/nui.nvim",
    },
    opts = config,
    keys = keys,
    -- event = {"StdinReadPre", "VimEnter"}
}
